package com.xlhl.init.exceptipn;

import com.xlhl.init.common.CustomHttpCode;
import lombok.Getter;

/**
 * @author xlhl
 */
@Getter
public class BusinessException extends RuntimeException {
    private final int code;

    public BusinessException(int code, String message) {
        super(message);
        this.code = code;
    }

    public BusinessException(String message) {
        super(message);
        this.code = CustomHttpCode.SYSTEM_ERROR.getCode();
    }

    public BusinessException(CustomHttpCode httpCode) {
        super(httpCode.getMessage());
        this.code = httpCode.getCode();
    }

    public BusinessException(CustomHttpCode httpCode, String message) {
        super(message);
        this.code = httpCode.getCode();
    }
}
